﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using LGE;

namespace LGE
{
    public class CheckBox
    {
        Texture2D sprite;
        public Vector2 position;
        Rectangle rect { get { return new Rectangle((int)position.X, (int)position.Y, sprite.Width / 2, sprite.Height); } }
        Rectangle sr { get { return new Rectangle((Checked ? 1 : 0) * (sprite.Width / 2), 0, sprite.Width / 2, sprite.Height); } }
        public bool Clicked { get { return Input.MouseClick && rect.Contains((int)Input.MousePos.X, (int)Input.MousePos.Y); } }

        public bool Checked = true;

        public CheckBox(Texture2D sprite, Vector2 position)
        {
            this.sprite = sprite;
            this.position = position;
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(sprite, position, sr, Color.White);
        }
    }
}
